package com.refuel.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author zhanghao
 * @description 便于检测服务是否存在
 * @date 2024/4/11 16:29
 **/
@RestController
@RequestMapping("/detect")
@Tag(name = "服务检测控制器", description = "服务检测相关接口")
public class DetectControl {

    /**
     * 检测服务是否存活
     * @return 返回当前时间
     */
    @Operation(summary = "服务检测接口")
    @ApiResponses({
            @ApiResponse(responseCode = "200", description = "成功")
    })
    @GetMapping("/live")
    public String live() {
        Date now = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return sdf.format(now);
    }
}
